home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 1 / Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso / FILES / HYP / E-G / educationstacks.sea / Circuits / card_2832.txt < prev    next >
Text File  |  1989-02-26  |  9KB  |  392 lines

  1. -- card: 2832 from stack: in
  2. -- bmap block id: 2398
  3. -- flags: 4000
  4. -- background id: 2693
  5. -- name: 
  6. ----- HyperTalk script -----
  7. on calculate
  8.   get char 1 of card field "EMF"
  9.   if it="+" then
  10.     delete char 1 of card field "EMF"
  11.   end if
  12.   put card field "EMF" into E
  13.  
  14.   get char 1 of card field "R1"
  15.   if it="+" then
  16.     delete char 1 of card field "R1"
  17.   end if
  18.   put card field "R1" into R1
  19.   put abs(R1) into R1
  20.   put R1 into card field "R1"
  21.  
  22.   get char 1 of card field "R2"
  23.   if it="+" then
  24.     delete char 1 of card field "R2"
  25.   end if
  26.   put card field "R2" into R2
  27.   put abs(R2) into R2
  28.   put R2 into card field "R2"
  29.  
  30.   get char 1 of card field "R3"
  31.   if it="+" then
  32.     delete char 1 of card field "R3"
  33.   end if
  34.   put card field "R3" into R3
  35.   put abs(R3) into R3
  36.   put R3 into card field "R3"
  37.  
  38.   if E=0 then
  39.     send zeroall
  40.     exit calculate
  41.   end if
  42.  
  43.   if E<>0 and R1=0 then
  44.  
  45.     if R2=0 and R3<>0 then
  46.       put 0 into card field "A3"
  47.       put 0 into card field "V1"
  48.       --blow up A1 and A2
  49.       put "zap" into card field "A1"
  50.       put "zap" into card field "A2"
  51.     end if
  52.  
  53.     if R3=0 and R2<>0 then
  54.       put 0 into card field "A2"
  55.       put 0 into card field "V1"
  56.       --blow up A1 and A3
  57.       put "zap" into card field "A1"
  58.       put "zap" into card field "A3"
  59.     end if
  60.  
  61.     if R2=0 and R3=0 then
  62.       put 0 into card field "V1"
  63.       --blow up A1, A2, & A3
  64.       put "zap" into card field "A1"
  65.       put "zap" into card field "A2"
  66.       put "zap" into card field "A3"
  67.     end if
  68.  
  69.     if R2=0 or R3=0 then
  70.       exit calculate
  71.     end if
  72.  
  73.   end if
  74.  
  75.  
  76.   if R2=0 and R3=0 then
  77.     put 0 into V1
  78.     put E/R1 into I1
  79.     put I1/2 into I2
  80.     put I2 into I3
  81.   else
  82.     put R2*R3/(R2+R3) into RP
  83.     put E/(R1+RP) into I1
  84.     put I1*RP into V1
  85.     if R2=0 then
  86.       put I1 into I2
  87.     else
  88.       put V1/R2 into I2
  89.     end if
  90.     if R3=0 then
  91.       put I1 into I3
  92.     else
  93.       put V1/R3 into I3
  94.     end if
  95.   end if
  96.  
  97.   set the numberFormat to "0.000"
  98.   put I1 into card field "A1"
  99.   put I2 into card field "A2"
  100.   put I3 into card field "A3"
  101.   put 1*V1 into card field "V1"
  102.  
  103. end calculate
  104.  
  105. on closeField
  106.   set hilite of card button "S1 closed" to false
  107.   set hilite of card button "S1 middle" to true
  108.   set hilite of card button "S1 middle" to false
  109.   set hilite of card button "S1 open" to true
  110.   send zeroall
  111. end closeField
  112.  
  113. on zeroall
  114.   put 0 into card field "V1"
  115.   put 0 into card field "A1"
  116.   put 0 into card field "A2"
  117.   put 0 into card field "A3"
  118. end zeroall
  119.  
  120.  
  121.  
  122. -- part 2 (field)
  123. -- low flags: 01
  124. -- high flags: 0002
  125. -- rect: left=44 top=87 right=102 bottom=100
  126. -- title width / last selected line: 0
  127. -- icon id / first selected line: 0 / 0
  128. -- text alignment: 65535
  129. -- font id: 3
  130. -- text size: 10
  131. -- style flags: 256
  132. -- line height: 13
  133. -- part name: A1
  134.  
  135.  
  136. -- part 3 (field)
  137. -- low flags: 01
  138. -- high flags: 0002
  139. -- rect: left=192 top=91 right=106 bottom=254
  140. -- title width / last selected line: 0
  141. -- icon id / first selected line: 0 / 0
  142. -- text alignment: 65535
  143. -- font id: 3
  144. -- text size: 10
  145. -- style flags: 256
  146. -- line height: 13
  147. -- part name: V1
  148.  
  149.  
  150. -- part 4 (field)
  151. -- low flags: 01
  152. -- high flags: 0002
  153. -- rect: left=168 top=148 right=163 bottom=224
  154. -- title width / last selected line: 0
  155. -- icon id / first selected line: 0 / 0
  156. -- text alignment: 65535
  157. -- font id: 3
  158. -- text size: 10
  159. -- style flags: 256
  160. -- line height: 13
  161. -- part name: A2
  162.  
  163.  
  164. -- part 5 (field)
  165. -- low flags: 01
  166. -- high flags: 0002
  167. -- rect: left=168 top=217 right=232 bottom=224
  168. -- title width / last selected line: 0
  169. -- icon id / first selected line: 0 / 0
  170. -- text alignment: 65535
  171. -- font id: 3
  172. -- text size: 10
  173. -- style flags: 256
  174. -- line height: 13
  175. -- part name: A3
  176.  
  177.  
  178. -- part 6 (field)
  179. -- low flags: 00
  180. -- high flags: 0000
  181. -- rect: left=251 top=31 right=47 bottom=285
  182. -- title width / last selected line: 0
  183. -- icon id / first selected line: 0 / 0
  184. -- text alignment: 65535
  185. -- font id: 3
  186. -- text size: 10
  187. -- style flags: 256
  188. -- line height: 13
  189. -- part name: R1
  190.  
  191.  
  192. -- part 7 (field)
  193. -- low flags: 00
  194. -- high flags: 0000
  195. -- rect: left=279 top=152 right=168 bottom=313
  196. -- title width / last selected line: 0
  197. -- icon id / first selected line: 0 / 0
  198. -- text alignment: 65535
  199. -- font id: 3
  200. -- text size: 10
  201. -- style flags: 256
  202. -- line height: 13
  203. -- part name: R2
  204.  
  205.  
  206. -- part 9 (field)
  207. -- low flags: 00
  208. -- high flags: 0000
  209. -- rect: left=280 top=223 right=239 bottom=314
  210. -- title width / last selected line: 0
  211. -- icon id / first selected line: 0 / 0
  212. -- text alignment: 65535
  213. -- font id: 3
  214. -- text size: 10
  215. -- style flags: 256
  216. -- line height: 13
  217. -- part name: R3
  218.  
  219.  
  220. -- part 10 (field)
  221. -- low flags: 00
  222. -- high flags: 0000
  223. -- rect: left=187 top=23 right=39 bottom=221
  224. -- title width / last selected line: 0
  225. -- icon id / first selected line: 0 / 0
  226. -- text alignment: 65535
  227. -- font id: 3
  228. -- text size: 10
  229. -- style flags: 256
  230. -- line height: 13
  231. -- part name: EMF
  232.  
  233.  
  234. -- part 14 (button)
  235. -- low flags: 00
  236. -- high flags: 4001
  237. -- rect: left=330 top=82 right=102 bottom=342
  238. -- title width / last selected line: 0
  239. -- icon id / first selected line: 0 / 0
  240. -- text alignment: 1
  241. -- font id: 0
  242. -- text size: 12
  243. -- style flags: 0
  244. -- line height: 16
  245. -- part name: S1 closed
  246. ----- HyperTalk script -----
  247. on mouseUp
  248.   get hilite of card button "S1 closed"
  249.   if it=true then
  250.     set hilite of card button "S1 closed" to false
  251.     set hilite of card button "S1 middle" to true
  252.     set hilite of card button "S1 middle" to false
  253.     set hilite of card button "S1 open" to true
  254.     send zeroall
  255.   else
  256.     set hilite of card button "S1 open" to false
  257.     set hilite of card button "S1 middle" to true
  258.     set hilite of card button "S1 middle" to false
  259.     set hilite of card button "S1 closed" to true
  260.     send calculate
  261.   end if
  262. end mouseUp
  263.  
  264.  
  265. -- part 15 (button)
  266. -- low flags: 00
  267. -- high flags: 0001
  268. -- rect: left=319 top=82 right=102 bottom=331
  269. -- title width / last selected line: 0
  270. -- icon id / first selected line: 0 / 0
  271. -- text alignment: 1
  272. -- font id: 0
  273. -- text size: 12
  274. -- style flags: 0
  275. -- line height: 16
  276. -- part name: S1 middle
  277. ----- HyperTalk script -----
  278. on mouseUp
  279.   get hilite of card button "S1 closed"
  280.   if it=true then
  281.     set hilite of card button "S1 closed" to false
  282.     set hilite of card button "S1 middle" to true
  283.     set hilite of card button "S1 middle" to false
  284.     set hilite of card button "S1 open" to true
  285.     send zeroall
  286.   else
  287.     set hilite of card button "S1 open" to false
  288.     set hilite of card button "S1 middle" to true
  289.     set hilite of card button "S1 middle" to false
  290.     set hilite of card button "S1 closed" to true
  291.     send calculate
  292.   end if
  293. end mouseUp
  294.  
  295.  
  296. -- part 16 (button)
  297. -- low flags: 00
  298. -- high flags: 0001
  299. -- rect: left=307 top=82 right=102 bottom=319
  300. -- title width / last selected line: 0
  301. -- icon id / first selected line: 0 / 0
  302. -- text alignment: 1
  303. -- font id: 0
  304. -- text size: 12
  305. -- style flags: 0
  306. -- line height: 16
  307. -- part name: S1 open
  308. ----- HyperTalk script -----
  309. on mouseUp
  310.   get hilite of card button "S1 closed"
  311.   if it=true then
  312.     set hilite of card button "S1 closed" to false
  313.     set hilite of card button "S1 middle" to true
  314.     set hilite of card button "S1 middle" to false
  315.     set hilite of card button "S1 open" to true
  316.     send zeroall
  317.   else
  318.     set hilite of card button "S1 open" to false
  319.     set hilite of card button "S1 middle" to true
  320.     set hilite of card button "S1 middle" to false
  321.     set hilite of card button "S1 closed" to true
  322.     send calculate
  323.   end if
  324. end mouseUp
  325.  
  326.  
  327. -- part 17 (button)
  328. -- low flags: 00
  329. -- high flags: 0000
  330. -- rect: left=342 top=83 right=102 bottom=403
  331. -- title width / last selected line: 0
  332. -- icon id / first selected line: 0 / 0
  333. -- text alignment: 1
  334. -- font id: 0
  335. -- text size: 12
  336. -- style flags: 0
  337. -- line height: 16
  338. -- part name: Switch
  339. ----- HyperTalk script -----
  340. on mouseUp
  341.   get hilite of card button "S1 closed"
  342.   if it=true then
  343.     set hilite of card button "S1 closed" to false
  344.     set hilite of card button "S1 middle" to true
  345.     set hilite of card button "S1 middle" to false
  346.     set hilite of card button "S1 open" to true
  347.     send zeroall
  348.   else
  349.     set hilite of card button "S1 open" to false
  350.     set hilite of card button "S1 middle" to true
  351.     set hilite of card button "S1 middle" to false
  352.     set hilite of card button "S1 closed" to true
  353.     send calculate
  354.   end if
  355. end mouseUp
  356.  
  357.  
  358. -- part contents for card part 10
  359. ----- text -----
  360. 36
  361.  
  362. -- part contents for card part 6
  363. ----- text -----
  364. 4
  365.  
  366. -- part contents for card part 7
  367. ----- text -----
  368. 12
  369.  
  370. -- part contents for card part 9
  371. ----- text -----
  372. 24
  373.  
  374. -- part contents for card part 2
  375. ----- text -----
  376. 3.000
  377.  
  378. -- part contents for card part 4
  379. ----- text -----
  380. 2.000
  381.  
  382. -- part contents for card part 5
  383. ----- text -----
  384. 1.000
  385.  
  386. -- part contents for card part 3
  387. ----- text -----
  388. 24.000
  389.  
  390. -- part contents for background part 8
  391. ----- text -----
  392. C4. Series-Parallel